<template>
  <div>
    <Dialog ref="dialog" v-bind="$attrs" @confirm="confirm">
      <Form v-bind="$attrs" v-on="$listeners" ref="form"></Form>
    </Dialog>
  </div>
</template>

<script>
export default {
  name: "DF",
  mounted() {
    const { hide, start, stop } = this.$refs.dialog;
    Object.assign(this, { hide, start, stop });
  },
  methods: {
    /**
     * 显示
     */
    show() {
      this.$refs.dialog.show();
      this.$nextTick(() => {
        this.$refs.form.clear();
      });
    },
    /**
     * 点击确认按钮
     */
    async confirm() {
      try {
        await this.$refs.form.validate();
        this.$emit("confirm");
      } catch (error) {}
    },
  },
};
</script>

<style>
</style>